﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;

namespace test
{
    class Program
    {
        public static window FindWindowByTitle(string title)
        {
            var ws = window.GetOpenWindows();

            var result = 
                from 
                    w in ws
                where 
                    w.Title == title
                select 
                    w;

            return result.Single();
        }

        static void Main(string[] args)
        {
            Console.WriteLine("Test v0.1");

            var w = FindWindowByTitle("File Download");
            Thread.Sleep(1000);
            winapi.SetForegroundWindow(w.Handle);
            Thread.Sleep(1000);
            SendKeys.SendWait("%S");
            Thread.Sleep(1000);
            SendKeys.SendWait("g:\\financial\\test1.qfx{ENTER}");
            Thread.Sleep(1000);
            SendKeys.SendWait("{ESC}");
            Thread.Sleep(1000);
        }
    }
}
